/*
 * Author : Yuval Kovler 2011
 * 
 */

package implementation.client;

import java.util.ArrayList;
import java.util.HashMap;


public class CUserInput implements IUserInput{
	
	//http://download.oracle.com/javase/1.5.0/docs/api/java/util/LinkedHashMap.html
	// a LinkedHashMap is a map that maintains items in the order they were inserted, consider using instead of arrays.
	
	private ArrayList<String> _userOutput ;
	private ArrayList<String> _userInput ;
	private ArrayList<EUserAction> _userOperations ;
	private EUserAction _selectedAction;
	private HashMap<EUserParam,Object> _params;
	
	public CUserInput(){	
		
		_selectedAction=EUserAction.EBack;
		_userOutput=new ArrayList<String>();
		_userInput=new ArrayList<String>();
		_userOperations=new ArrayList<EUserAction>();	
		this._params = new HashMap<EUserParam, Object>();
		
	}	
	
		
	public int paramCount() {
		
		return _userOutput.size();
	}
	
	
	public String getUserParameterName(int index) {
		
		return _userOutput.get(index);
	}
	
	public void setUserParameterName(int index, String input) {
		_userOutput.set(index, input);
	}

	
	public String getUserParameter(int index) {
		
		return _userInput.get(index);
	}

	
	public void setUserParameter(int index , String input) {
		_userInput.set(index, input);
		
	}
	
	public ArrayList<EUserAction> getListOfOperations() {		
		return _userOperations;
	}

	
	public void addUserOutput(String output) {
		_userOutput.add(output);
		_userInput.add("no data enterd!!");
		
	}

	
	public void addUserOperation(EUserAction operation) {
		_userOperations.add(operation);
		
	}
	
	public void removeUserOperation(EUserAction operation) {
		_userOperations.remove(operation);
		
	}
	
	public EUserAction getSelectedAction() {
		
		return _selectedAction;
	}

	
	public void setSelectedAction(EUserAction selectedAction) {
		_selectedAction=selectedAction;
		
	}


	@Override
	public Object getParam(EUserParam param) {
		return this._params.get(param);
	}


	@Override
	public void setParam(EUserParam param, Object value) {
		this._params.put(param, value);
	}


	@Override
	public void addParam(EUserParam param) {
		this._params.put(param, null);
	}

}
